package org.grayrabbit.cloud.core.rpc;

import org.grayrabbit.cloud.core.handler.HandlerException;
import org.grayrabbit.cloud.core.mina.RemoteChannel;
import org.grayrabbit.cloud.core.mina.RemoteInvokeException;

public class LocalChannel implements Channel<Result> {
	private RemoteChannel remote;
	public LocalChannel(RemoteChannel remote) {
		this.remote = remote;
	}

	public Result invoke(Argument argument) throws ChannelException, HandlerException {
		try {
			return remote.invoke(argument);
		} catch (RemoteInvokeException e) {
			throw new HandlerException(e);
		}
	}
}
